home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
FishMarket 1.0
/
FishMarket v1.0.iso
/
fishies
/
526-550
/
disk_543
/
wbplane
/
addwbplane.asm
< prev
next >
Wrap
Assembly Source File
|
1992-05-06
|
3KB
|
118 lines
* AddWBplane
*
* Adds a bitplane to the Workbench screen.
*
*
*HISTORY
* Made with Hisoft V2.12
* V1.0 27-Jun-91: First attempt. Works of course
OPT O+
OPT O1+ ; Tells when a branch could be optimised to short
OPT i+ ; Tells when '#' is probably missing
incdir "AsmInc:"
include "P.i"
include "relMacros.i"
include "exec/exec_lib.i"
include "libraries/dosextens.i"
include "graphics/graphics_lib.i"
include "intuition/intuition_lib.i"
include "intuition/intuition.i"
Planes EQUR D2
Index EQUR D3
WScreen EQUR A2
WBitMap EQUR A3
DB EQUR A4
dcDeclare A4
dcAPtr WBMsg
dcAPtr GraphBase
dcAPtr IntuiBase
dcEnd
Start dcAlloc
dcReset
Prepare Exec_Call
suba.l A1,A1
CallLib FindTask ; Find us
movea.l D0,A2
tst.l pr_CLI(A2)
bne.S GetLibs
WBStart lea pr_MsgPort(A2),A0
CallLib WaitPort ; wait for a message
lea pr_MsgPort(A2),A0
CallLib GetMsg ; then get it
move.l D0,WBMsg(DB) ; save it for later reply
GetLibs lea GfxName(PC),A1
CallLib OldOpenLibrary
move.l D0,GraphBase(DB)
beq Error
lea IntuiName(PC),A1
CallLib OldOpenLibrary
move.l D0,IntuiBase(DB)
beq.S Error
*»»» Find Workbench screen
CallLib Forbid
move.l IntuiBase(DB),A0
move.l ib_FirstScreen(A0),WScreen
1$ move.l WScreen,D0
beq.S 3$
move.w sc_Flags(WScreen),D0
andi.w #SCREENTYPE,D0
cmpi.w #WBENCHSCREEN,D0 ; Workbench screen ?
beq.S 2$
move.l sc_NextScreen(WScreen),WScreen
bra.S 1$
*»»» Found Workbench screen
2$ lea sc_BitMap(WScreen),WBitMap
moveq #0,Planes
move.b bm_Depth(WBitMap),Planes
move.w Planes,Index
mulu #4,Index
addq.w #1,Planes
cmp.w #4,Planes
bgt.S 3$
move.w sc_Width(WScreen),D0
move.w sc_Height(WScreen),D1
Prepare Gfx_Call
CallLib AllocRaster
move.l D0,bm_Planes(WBitMap,Index)
beq.S 3$
move.l D0,A1
move.w bm_Rows(WBitMap),D0
swap D0
move.w bm_BytesPerRow(WBitMap),D0
moveq #2,D1
CallLib BltClear
move.b Planes,bm_Depth(WBitMap)
Prepare Intuition_Call
CallLib RemakeDisplay
3$ Prepare Exec_Call
CallLib Permit
Error
Exit Prepare Exec_Call
FreeIntui move.l IntuiBase(DB),D0
beq.S FreeGfx
move.l D0,A1
CallLib CloseLibrary
FreeGfx move.l GraphBase(DB),D0
beq.S ReplyWB
move.l D0,A1
CallLib CloseLibrary
ReplyWB move.l WBMsg(DB),D2
beq.S AllDone
CallLib Forbid ; We were started from WB
movea.l D2,A1
CallLib ReplyMsg ; Reply WBMessage
AllDone dcFree
moveq #0,D0
rts
GfxName dc.b 'graphics.library',0
IntuiName dc.b 'intuition.library',0
END